package com.qqtop10.manager.utils.http.help;

import java.io.IOException;
import java.util.List;

import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;

import com.qqtop10.manager.utils.http.entity.CustomerService;
import com.qqtop10.manager.utils.http.entity.OauthBody;
import com.qqtop10.manager.utils.http.entity.SellerClassify;

public class ParseHelper {

	public static OauthBody parseOauthTokenData(String responseData) {
		ObjectMapper jsonMapper = new ObjectMapper();
		try {
			return jsonMapper.readValue(responseData, OauthBody.class);
		} catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	}

	public static List<SellerClassify> parseClassify(String classifyStr) {
		ObjectMapper mapper = new ObjectMapper();
		try {
			return mapper.readValue(classifyStr, new TypeReference<List<SellerClassify>>() {
			});
		} catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	}

	public static CustomerService parseCustomService(String content) {
		ObjectMapper mapper = new ObjectMapper();
		try {
			return mapper.readValue(content, CustomerService.class);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
}
